package hn.cch.version.lts21;

import java.util.concurrent.CountDownLatch;

/**
 * 虚拟线程，默认是守护线程，不能设置优先级和线程组
 */
public class VirtualThreadDemo {

    public static void main(String[] args) {

        int count = 2;
        CountDownLatch countDownLatch = new CountDownLatch(count);
        for (int i = 0; i < count; i++) {
            Thread.ofVirtual().start(new Runnable() {
                @Override
                public void run() {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            });
        }

    }

}
